﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SysAdmin._04_Form._00_Common
{
    public partial class AlertDialogForm : Form
    {
        public string Msg { get; set; }

        public AlertDialogForm()
        {
            InitializeComponent();
        }

        private void DialogForm_Load(object sender, EventArgs e)
        {
            label1.Text = Msg;

            int x = (int)(ClientSize.Width / 2) - (int)(label1.Width / 2);
            int y = (int)(ClientSize.Height / 2) - (int)(label1.Height / 2);
            label1.Location = new Point(x, y);
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Enter)
            {
                DialogResult = DialogResult.OK;
                Close();

                return true;
            }
            else
            {
                return base.ProcessCmdKey(ref msg, keyData);
            }
        }
    }
}
